#{extends 'main.html' /}
#{set title:'Ma liste d\'envie' /}

    
	    
<div class="form">
	    <span class="bigtitle">Ma liste d'envie</span>

	    <div id="cmd_add"
			class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-primary">
			<span class="ui-button-icon-primary ui-icon ui-icon-plus"></span>
		</div>
	    
	    #{paginate.controls items:list.book /} 
	    #{paginate.summary items:list /}
	    <table class="table_gridview">
	    	<tr>
		    	<th>Titre</th>
		    	<th>Auteur</th>
		    </tr>
		    #{paginate.list items:list, as:'want'} 
	    		<tr class="${want_parity}">
	    			<td>
	    				#{if want.type == 1} 
	    					<a href="@{bookmngt.displayone(want.book.id)}">
		    					${want.book.title}
		    				</a>
	    				#{/if}
	    				#{if want.type == 2} 
	    					<a href="@{cartoonmngt.displayone(want.cartoon.id)}">
		    					${want.cartoon.title}
		    				</a>
	    				#{/if}
	    			</td>
	    			<td>
	    				#{if want.type == 1} 
	    					<a href="@{author.displaylist(want.book.author.id)}">
		    					${want.book.author.firstname} ${want.book.author.name}
		    				</a>
	    				#{/if}
	    				#{if want.type == 2} 
	    					<a href="@{author.displaylist(want.cartoon.writer.id)}">
		    					${want.cartoon.writer.firstname} ${want.cartoon.writer.name}
		    				</a>
	    				#{/if}
	    			</td>
	    		</tr>
		    #{/paginate.list}
		</table>
	    #{else}
	      Empty list!
	    #{/else}
	    
</div>
	   
<script language="javascript" type="text/javascript">
$(document).ready(function(){

	$("#cmd_add").click(function() {
		*{window.location = '@{wantmngt.addform}'}*
	});

});
</script>
	    